package com.wang.tool.monitor.core;

import java.io.Serializable;
import java.util.Objects;

/**
 * 摘要
 *
 * @author shaopeng
 * @date 2022/8/27
 */
public class Digest implements Serializable {

    private static final long serialVersionUID = -4221416475600320143L;

    /**
     * key
     */
    private String k;

    /**
     * 值
     */
    private String v;

    public Digest() {
    }

    public Digest(String k, String v) {
        this.k = k;
        this.v = v;
    }

    public String getK() {
        return k;
    }

    public void setK(String k) {
        this.k = k;
    }

    public String getV() {
        return v;
    }

    public void setV(String v) {
        this.v = v;
    }

    @Override
    public String toString() {
        return k + "|" + (v == null ? "-" : v);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Digest digest = (Digest) o;
        return Objects.equals(k, digest.k) &&
                Objects.equals(v, digest.v);
    }

    @Override
    public int hashCode() {
        return Objects.hash(k, v);
    }
}
